
from WtfEngine import *;
from scripts.widgets.TreeView import *;
import DataView;

font = WtfGui.Font("v_wtfEdit_ui_font");

class ObjectView(TreeView):
	def __init__(self):
		TreeView.__init__(self, "World", font);
		self.RefreshAll();
	
	def RefreshAll(self):
		#self.Clear();
		map(lambda obj: self.AddChild(Object(obj)), PhysicsEngine.GetInst().objects);
	

class Object(TreeView):
	def __init__(self, obj):
		TreeView.__init__(self, obj.name, font);
		
		DebugPrint(obj.name);
		
		#Enumerate parameters
		for n in dir(obj):
			v = getattr(obj,n);
			if not n.startswith("_") and not callable(v):
				self.AddChild(ObjectMember(n, v));

def ObjectMember(n, v):
	return DataView.Member(n, v, font);
